home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Archive / Graphics / QuickDraw GX / GX->PostScript Sample / GXToPostScript / Imaging Engine / Level1Glyphs.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  2.9 KB  |  113 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Level1Glyphs.c
  3.  
  4.      Contains:    QuickDraw GX to PostScript conversion code.
  5.                          Routines for processing glyph runs using level-1 kshow.
  6.                         called from TextStylePrimitives.c
  7.  
  8.      Version:    Technology:    Quickdraw GX 1.1.x
  9.       
  10.      Copyright:    © 1991-1997 by Apple Computer, Inc., all rights reserved.
  11. */
  12.  
  13. #include "PublicPostScriptIE.h"
  14. #include "Private.h"
  15. #include "PSIEResources.h"
  16. #include <GXGraphics.h>
  17.  
  18. #ifdef resumeLabel
  19.     #undef resumeLabel
  20. #endif
  21. #define resumeLabel(exception)
  22.  
  23. /*******************************************
  24.     ProcessGlyphGroupPosL1:
  25.     
  26.     Routine translates a glyph group with advance
  27.     bits specifying absolute positions for the glyphs
  28.     to PostScript.
  29.     
  30.     nGlyphs:            How many glyphs in the group.
  31.     positions:        Array of positions for the glyphs.
  32.     text8:                Pointer to the 8 bit data for the group.
  33.     byteCount:        Number of bytes in the 8-bit data.
  34.     rdParams:            pointer to the RDUtil parameter block.
  35.     
  36. *********************************************/
  37. OSErr ProcessGlyphGroupPosL1(short nGlyphs, gxPoint *positions, char *text8, long byteCount,
  38.                                                             TRDParams *rdParams, TGlyphPosBias theBias, long addToIndex)
  39.     {
  40.         OSErr                        status;
  41.         gxPoint*                pPoint;
  42.         register short    j;
  43.                 
  44.         /* Put the pen at the position of the first glyph in the group */
  45.  
  46.         status = DoMoveto( rdParams, &(positions[0]));
  47.         nrequire(status, failed_Output);
  48.         
  49.         /** Output all of the positions in reverse order **/
  50.         
  51.         pPoint = positions + nGlyphs - 1;
  52.         
  53.         if (theBias == eAllHorizontal) {
  54.         
  55.             rdParams->resIndex = kDoFixed;
  56.             for (j = nGlyphs-2; j >= 0; --j) {                    // Do all but the first point.
  57.                     
  58.                 status = RDResPrintf(rdParams, pPoint->x);
  59.                 nrequire(status, failed_Output);
  60.                 --pPoint;
  61.                     
  62.             }//end for
  63.             
  64.             status = RDResPrintf(rdParams, positions[0].y);        // Output the constant Y value on the stack.
  65.             nrequire(status, failed_Output);
  66.             
  67.             rdParams->resIndex = addToIndex +  kKshowH;
  68.             
  69.         } else if (theBias == eAllVertical) {
  70.         
  71.             rdParams->resIndex = kDoFixed;
  72.             for (j = nGlyphs-2; j >= 0; --j) {                    // Do all but the first point.
  73.                     
  74.                 status = RDResPrintf(rdParams, pPoint->y);
  75.                 nrequire(status, failed_Output);
  76.                 --pPoint;
  77.                     
  78.             }//end for
  79.             
  80.             status = RDResPrintf(rdParams, positions[0].x);        // Output the constant Y value on the stack.
  81.             nrequire(status, failed_Output);
  82.  
  83.             rdParams->resIndex = addToIndex +  kKshowV;
  84.         
  85.         } else {
  86.         
  87.             rdParams->resIndex = kDoPoint;
  88.             for (j = nGlyphs-2; j >= 0; --j) {                    // Do all but the first point.
  89.                     
  90.                 status = RDResPrintf(rdParams, pPoint);
  91.                 nrequire(status, failed_Output);
  92.                 --pPoint;
  93.                     
  94.             }//end for
  95.             
  96.             if (byteCount == 1)                                // either will work, but for 1 byte show is more efficient.
  97.                 rdParams->resIndex = addToIndex +  kShow;
  98.             else
  99.                 rdParams->resIndex = addToIndex +  kKshow;
  100.         
  101.         } //end if
  102.             
  103.         status = RDResPrintf(rdParams, text8, byteCount);
  104.         nrequire(status, failed_Output);
  105.         
  106. failed_Output:    
  107.         return(status);
  108.     
  109.     }//ProcessGlyphGroupPosL1
  110.  
  111.  
  112.  
  113.